# cart = ['火腿肠', '牛奶', '面包', '卫生纸']
# for item in cart:
#     print(item)
"""
# 练习：定义列表，保存一组商品的价格；遍历列表，计算出商品的总价。
total = 0
product = [23, 18, 15, 30]
for item in product:
    # print(item)
    total += item
print('总价：', total)


s = 'hello world'
for item in s:
    print(item)

# 练习：统计出字符串welcometochina中o字符出现的次数。
count = 0
for item in 'welcometochina':
    # 判断每个字符是否为o
    if item == 'o':
        count += 1
print(count)
"""
# break continue else
total = 0
scores = [78, 54, 89, 97, 60, 50, 93]
for num in scores:
    # 找到所有不及格的成绩
    # if num >= 60: # 遇到60以上就跳过
    #     continue
    # 遇到60以下的结束循环
    # if num < 60:
    #     break
    # print(num)
    # 加到变量total
    total += num
else:
    print('总和：', total)






